<?php
/**
 * Created by PhpStorm.
 * User: xiaoxin
 * Date: 2018/11/16 0016
 * Time: 9:54
 */

namespace app\admin\validate;
use think\Validate;

class CheckAddAdmin extends Validate
{
	protected $rule = [
		'role_id'=>'require',
		'email' =>'email|unique:Admin',
		'password'=>'require|regex:[\w]{8,15}',
		'repassword'=>'require|confirm:password',
		'phone'=>'require|regex:^1[0-9]{10}$|unique:Admin',
		'nickname' =>'require|regex:[\w]{4,10}|unique:Admin',
	];

	protected $message  =   [
		'phone.require'=>'请填写手机号码',
		'phone.regex'=>'手机格式错误,请重新填写手机号码',
		'phone.unique'=>'手机号码已存在',
		'nickname.require'=>'请填写昵称',
		'role_id.require'=>'必须选择一个角色',
		'nickname.unique'=>'昵称已存在',
		'nickname.regex'=>'昵称格式错误,昵称最小需要4位',
		'password.require'=>'请填写密码',
		'password.regex'=>'密码最少需要8位,最多15位',
		'repassword.require'=>'请确认密码',
		'repassword.confirm'=>'两次密码不一致',
		'email'=> '邮箱格式错误',
		'email.unique'=> '邮箱已存在',
	];
}